<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class CreditModel extends Model
{
    //积分物品信息表
    protected $table = 'credit_item';   //数据表
    protected $pk = 'credit_item_id';  //主键

    protected $schema=[
        'credit_item_id' => 'int',
        'credit_item_name' => 'string',
        'credit_item_info' => 'string',
        'credit_item_img' => 'string',
        'credit_item_req_credit' => 'int',
        'credit_item_stock' => 'int',
        'credit_item_type' => 'int',
        'credit_item_time' => 'datetime',
    ];


    public static function getAllCreditInfo()
    {
        return CreditModel::field('credit_item_id,credit_item_name,credit_item_info,credit_item_img,credit_item_req_credit,credit_item_stock,credit_item_type')->select();
    }

    public static function getCreditByPeeId($credit_item_id)
    {
        return CreditModel::where('credit_item_id',$credit_item_id)->find();
    }
}
